<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="1. 两数之和给定一个整数数组和一个目标值，找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案，且同样的元素不能被重复利用。 这题我用了点类似背包问题的思想，总值为k 当前值为n 那么只要判断k-n 这个直在不在就行了，hashmap解决 123456789101112131415161718class Solution &amp;#123;public int[] twoSum(int[]">
<meta property="og:type" content="article">
<meta property="og:title" content="kyssion-blog">
<meta property="og:url" content="http://yoursite.com/2018/10/09/算法阶段性小结(二)/index.html">
<meta property="og:site_name" content="kyssion-blog">
<meta property="og:description" content="1. 两数之和给定一个整数数组和一个目标值，找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案，且同样的元素不能被重复利用。 这题我用了点类似背包问题的思想，总值为k 当前值为n 那么只要判断k-n 这个直在不在就行了，hashmap解决 123456789101112131415161718class Solution &amp;#123;public int[] twoSum(int[]">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2018-10-09T07:22:37.341Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="kyssion-blog">
<meta name="twitter:description" content="1. 两数之和给定一个整数数组和一个目标值，找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案，且同样的元素不能被重复利用。 这题我用了点类似背包问题的思想，总值为k 当前值为n 那么只要判断k-n 这个直在不在就行了，hashmap解决 123456789101112131415161718class Solution &amp;#123;public int[] twoSum(int[]">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2018/10/09/算法阶段性小结(二)/"/>





  <title> | kyssion-blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">kyssion-blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br />
            
            日程表
          </a>
        </li>
      
        
        <li class="menu-item menu-item-sitemap">
          <a href="/sitemap.xml" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br />
            
            站点地图
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/10/09/算法阶段性小结(二)/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="kyssion">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="kyssion-blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline"></h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-10-09T15:22:37+08:00">
                2018-10-09
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="1-两数之和"><a href="#1-两数之和" class="headerlink" title="1. 两数之和"></a>1. 两数之和</h3><p>给定一个整数数组和一个目标值，找出数组中和为目标值的两个数。<br>你可以假设每个输入只对应一种答案，且同样的元素不能被重复利用。</p>
<p>这题我用了点类似背包问题的思想，总值为k 当前值为n 那么只要判断k-n 这个直在不在就行了，hashmap解决</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Solution</span> </span>&#123;</span><br><span class="line"><span class="keyword">public</span> <span class="keyword">int</span>[] twoSum(<span class="keyword">int</span>[] nums, <span class="keyword">int</span> target) &#123;</span><br><span class="line">        HashMap&lt;Integer,Integer&gt; hashMap = <span class="keyword">new</span> HashMap&lt;&gt;();</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;nums.length;a++)&#123;</span><br><span class="line">            hashMap.put(nums[a],a);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">int</span>[] need = <span class="keyword">new</span> <span class="keyword">int</span>[<span class="number">2</span>];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;nums.length;a++)&#123;</span><br><span class="line">            <span class="keyword">int</span> end = target-nums[a];</span><br><span class="line">            <span class="keyword">if</span> (hashMap.get(end)!=<span class="keyword">null</span>&amp;&amp;hashMap.get(end)&gt;a)&#123;</span><br><span class="line">                need[<span class="number">0</span>]=a;</span><br><span class="line">                need[<span class="number">1</span>]=hashMap.get(end);</span><br><span class="line">                <span class="keyword">return</span> need;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> need;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="2-两数相加"><a href="#2-两数相加" class="headerlink" title="2. 两数相加"></a>2. 两数相加</h3><p>给定两个非空链表来表示两个非负整数。位数按照逆序方式存储，它们的每个节点只存储单个数字。将两数相加返回一个新的链表。</p>
<p>你可以假设除了数字 0 之外，这两个数字都不会以零开头。</p>
<p>示例：</p>
<p>输入：(2 -&gt; 4 -&gt; 3) + (5 -&gt; 6 -&gt; 4)<br>输出：7 -&gt; 0 -&gt; 8<br>原因：342 + 465 = 807</p>
<p>没什么java 链表基础，注意java中没有变量的变量</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code02</span> </span>&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">int</span> jin;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> ListNode <span class="title">createNextNode</span><span class="params">(<span class="keyword">int</span> l1, <span class="keyword">int</span> l2, ListNode before)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> number = l1 + l2 + jin;</span><br><span class="line">        jin = number / <span class="number">10</span>;</span><br><span class="line">        number = number % <span class="number">10</span>;</span><br><span class="line">        ListNode nowNode = <span class="keyword">new</span> ListNode(number);</span><br><span class="line">        <span class="keyword">if</span> (before != <span class="keyword">null</span>) &#123;</span><br><span class="line">            before.next = nowNode;</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            end = nowNode;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> nowNode;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">static</span> ListNode end = <span class="keyword">null</span>;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> ListNode <span class="title">addTwoNumbers</span><span class="params">(ListNode l1, ListNode l2)</span> </span>&#123;</span><br><span class="line">        ListNode before = <span class="keyword">null</span>;</span><br><span class="line">        jin = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> number1 = l1.val;</span><br><span class="line">        <span class="keyword">int</span> number2 = l2.val;</span><br><span class="line">        <span class="keyword">do</span> &#123;</span><br><span class="line">            before = createNextNode(number1, number2, before);</span><br><span class="line">            <span class="keyword">if</span> (l1 != <span class="keyword">null</span>) &#123;</span><br><span class="line">                l1 = l1.next;</span><br><span class="line">                number1 = l1 == <span class="keyword">null</span> ? <span class="number">0</span> : l1.val;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span> (l2 != <span class="keyword">null</span>) &#123;</span><br><span class="line">                l2 = l2.next;</span><br><span class="line">                number2 = l2 == <span class="keyword">null</span> ? <span class="number">0</span> : l2.val;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125; <span class="keyword">while</span> (l1 != <span class="keyword">null</span> || l2 != <span class="keyword">null</span>);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> (jin &gt; <span class="number">0</span>) &#123;</span><br><span class="line">            ListNode listNode = <span class="keyword">new</span> ListNode(jin);</span><br><span class="line">            before.next = listNode;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> end;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="3-无重复字符的最长子串"><a href="#3-无重复字符的最长子串" class="headerlink" title="3. 无重复字符的最长子串"></a>3. 无重复字符的最长子串</h3><p>给定一个字符串，找出不含有重复字符的最长子串的长度。</p>
<p>示例：</p>
<p>给定 “abcabcbb” ，没有重复字符的最长子串是 “abc” ，那么长度就是3。</p>
<p>给定 “bbbbb” ，最长的子串就是 “b” ，长度是1。</p>
<p>给定 “pwwkew” ，最长子串是 “wke” ，长度是3。请注意答案必须是一个子串，”pwke” 是 子序列  而不是子串。</p>
<p>这题有点意思，一开始就是自己想复杂了，用到了dp但是实际上根本不需要使用dp，其实就是一种找规律（窗体），和一定的优化方法（真的需要多一次遍历来进行去重吗），不要局限于之前的思想，要灵活</p>
<p>使用多一次循环去重<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code03</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">lengthOfLongestSubstring</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (s.length()==<span class="number">0</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span>[] at=s.toCharArray();</span><br><span class="line">        <span class="keyword">int</span> start = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> end =<span class="number">1</span>;</span><br><span class="line">        <span class="keyword">int</span> maxLength=<span class="number">1</span>;</span><br><span class="line">        <span class="keyword">int</span> nowLength=<span class="number">1</span>;</span><br><span class="line">        HashMap&lt;Character,Integer&gt; map = <span class="keyword">new</span> HashMap&lt;&gt;();</span><br><span class="line">        map.put(at[<span class="number">0</span>],<span class="number">0</span>);</span><br><span class="line">        <span class="keyword">while</span>(end&lt;at.length)&#123;</span><br><span class="line">            Integer integer = map.get(at[end]);</span><br><span class="line">            <span class="keyword">if</span> (integer!=<span class="keyword">null</span>)&#123;</span><br><span class="line">                nowLength-=integer-start+<span class="number">1</span>;</span><br><span class="line">                start=integer+<span class="number">1</span>;</span><br><span class="line">                map.clear();</span><br><span class="line">                <span class="keyword">for</span> (<span class="keyword">int</span> a=start;a&lt;end;a++)&#123;</span><br><span class="line">                    map.put(at[a],a);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            map.put(at[end],end);</span><br><span class="line">            end++;</span><br><span class="line">            nowLength++;</span><br><span class="line">            maxLength = maxLength&gt;nowLength?maxLength:nowLength;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> maxLength;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>不使用循环去重<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Solution</span> </span>&#123;</span><br><span class="line">         <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">lengthOfLongestSubstring</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">       <span class="keyword">int</span>[] map = <span class="keyword">new</span> <span class="keyword">int</span>[<span class="number">256</span>];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;map.length;a++)&#123;</span><br><span class="line">            map[a]=-<span class="number">1</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span>[] at = s.toCharArray();</span><br><span class="line">        <span class="keyword">int</span> start=<span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> length = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;at.length;a++)&#123;</span><br><span class="line">            <span class="keyword">if</span> (map[at[a]]&gt;=start)&#123;</span><br><span class="line">                start= map[at[a]]+<span class="number">1</span>;</span><br><span class="line"></span><br><span class="line">            &#125;</span><br><span class="line">            length= Math.max(length,a-start+<span class="number">1</span>);</span><br><span class="line">            map[at[a]]=a;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> length;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<h3 id="两个排序数组的中位数"><a href="#两个排序数组的中位数" class="headerlink" title="两个排序数组的中位数"></a>两个排序数组的中位数</h3><p>我认为这道题是我做过的最有用的一道题目，我的思维有种漏洞，这道问题锻炼人的思维，两个排序的数组，找到第k个数字，其实很简单。两个假设<br>假设1第一个数组中有n个数字那么第二个数组中就只有k-n个数字了。<br>假设2第一个数组去i位置的数字，第二个数组取j位置的数字，那么可以得到一个结论i和j位置对应的最大的那个数字，绝对是位置&gt;=i+j的数字，然后在看看i和j的后一位，i小于j的后一位，j小于i的后一位，那么就i+j最小数都找到了。。。。。说的太操蛋了</p>
<p>说白了就是看到了 如果我知道前k个第一个数组有多少个那么我就知道了第二个数组数的个数一定是k-第一个数组个数的个数，并且有一个约束条件就是假设2，就实现了递归了</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">double</span> <span class="title">findMedianSortedArrays</span><span class="params">(<span class="keyword">int</span>[] nums1, <span class="keyword">int</span>[] nums2)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> all = nums1.length + nums2.length;</span><br><span class="line">        <span class="keyword">if</span> ((all) % <span class="number">2</span> == <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> (finditme(nums1, nums2, all / <span class="number">2</span>) + finditme(nums1, nums2, all / <span class="number">2</span> + <span class="number">1</span>)) / <span class="number">2.0</span>;</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="keyword">return</span> (<span class="keyword">double</span>) finditme(nums1, nums2, all / <span class="number">2</span> + <span class="number">1</span>);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">finditme</span><span class="params">(<span class="keyword">int</span>[] n1, <span class="keyword">int</span>[] n2, <span class="keyword">int</span> k)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (n1.length &gt; n2.length) &#123;</span><br><span class="line">            <span class="keyword">return</span> finditme(n2, n1, k);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">int</span> n1index = n1.length &lt; k ? n1.length : k;</span><br><span class="line">        <span class="keyword">int</span> n2index = k - n1index;</span><br><span class="line">        <span class="keyword">while</span> (<span class="keyword">true</span>) &#123;</span><br><span class="line">            <span class="keyword">int</span> n1l = n1index == <span class="number">0</span> ? Integer.MIN_VALUE : n1[n1index - <span class="number">1</span>];</span><br><span class="line">            <span class="keyword">int</span> n1r = n1index == n1.length ? Integer.MAX_VALUE : n1[n1index];</span><br><span class="line">            <span class="keyword">int</span> n2l = n2index == <span class="number">0</span> ? Integer.MIN_VALUE : n2[n2index - <span class="number">1</span>];</span><br><span class="line">            <span class="keyword">int</span> n2r = n2index == n2.length ? Integer.MAX_VALUE : n2[n2index];</span><br><span class="line">            <span class="keyword">if</span> (n1l &gt; n2r) &#123;</span><br><span class="line">                <span class="keyword">int</span> n = n2index/<span class="number">2</span>==<span class="number">0</span>?<span class="number">1</span>:n2index/<span class="number">2</span>;</span><br><span class="line">                <span class="keyword">int</span> end1 = n1index-n&lt;<span class="number">0</span>?n1index:n;</span><br><span class="line">                <span class="keyword">int</span> end2 = n2index+n&gt;n2.length?n2.length-n2index:n;</span><br><span class="line">                end1 = Math.min(end1,end2);</span><br><span class="line">                n1index-=end1;</span><br><span class="line">                n2index+=end1;</span><br><span class="line">            &#125; <span class="keyword">else</span> <span class="keyword">if</span> (n2l &gt; n1r) &#123;</span><br><span class="line">                <span class="keyword">int</span> n = n1index/<span class="number">2</span>==<span class="number">0</span>?<span class="number">1</span>:n1index/<span class="number">2</span>;</span><br><span class="line">                <span class="keyword">int</span> end1 = n2index-n&lt;<span class="number">0</span>?n2index:n;</span><br><span class="line">                <span class="keyword">int</span> end2 = n1index+n&gt;n1.length?n1.length-n1index:n;</span><br><span class="line">                end1 = Math.min(end1,end2);</span><br><span class="line">                n2index-=end1;</span><br><span class="line">                n1index+=end1;</span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                <span class="keyword">return</span> Math.max(n1l, n2l);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code04</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="keyword">new</span> Code04().findMedianSortedArrays(</span><br><span class="line">                <span class="keyword">new</span> <span class="keyword">int</span>[]&#123;<span class="number">2</span>&#125;, <span class="keyword">new</span> <span class="keyword">int</span>[]&#123;<span class="number">1</span>, <span class="number">3</span>&#125;</span><br><span class="line">        ));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 我的做法很简单的 二分查找扩展，基于位置而不是值</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> nums1</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> nums2</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">double</span> <span class="title">findMedianSortedArrays</span><span class="params">(<span class="keyword">int</span>[] nums1, <span class="keyword">int</span>[] nums2)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (nums1.length == <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> getzhong(nums2);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (nums2.length == <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> getzhong(nums1);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (nums1.length == <span class="number">1</span> &amp;&amp; nums2.length == <span class="number">1</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> ((<span class="keyword">double</span>) nums1[<span class="number">0</span>] + (<span class="keyword">double</span>) nums2[<span class="number">0</span>]) / <span class="number">2.0</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">int</span> index = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> end = <span class="number">2</span>;</span><br><span class="line">        <span class="keyword">int</span>[][] need = <span class="keyword">new</span> <span class="keyword">int</span>[][]&#123;</span><br><span class="line">                &#123;(nums1.length + nums2.length) / <span class="number">2</span> + <span class="number">1</span>, -<span class="number">1</span>&#125;,</span><br><span class="line">                &#123;(nums1.length + nums2.length) % <span class="number">2</span> == <span class="number">0</span> ?</span><br><span class="line">                        (nums1.length + nums2.length) / <span class="number">2</span> :</span><br><span class="line">                        (nums1.length + nums2.length) / <span class="number">2</span> + <span class="number">1</span>, -<span class="number">1</span>&#125;</span><br><span class="line">        &#125;;</span><br><span class="line">        <span class="keyword">while</span> (index &lt; end) &#123;</span><br><span class="line">            <span class="keyword">int</span> ns1 = <span class="number">0</span>, ne1 = nums1.length - <span class="number">1</span>;</span><br><span class="line">            <span class="keyword">int</span> ns2 = <span class="number">0</span>, ne2 = nums2.length - <span class="number">1</span>;</span><br><span class="line">            <span class="keyword">while</span> (<span class="keyword">true</span>) &#123;</span><br><span class="line">                <span class="keyword">int</span> needone = nums1[(ns1 + ne1) / <span class="number">2</span>];</span><br><span class="line">                <span class="keyword">int</span> needtwo = nums2[(ns2 + ne2) / <span class="number">2</span>];</span><br><span class="line">                <span class="keyword">int</span> indexone = getAllIndex(nums2, (ns1 + ne1) / <span class="number">2</span>, needone, ns2, ne2, <span class="number">1</span>);</span><br><span class="line">                <span class="keyword">int</span> indextwo = getAllIndex(nums1, (ns2 + ne2) / <span class="number">2</span>, needtwo, ns1, ne1, <span class="number">2</span>);</span><br><span class="line">                <span class="keyword">if</span> (indexone &gt; need[index][<span class="number">0</span>]) &#123;</span><br><span class="line">                    ne1 = ((ns1 + ne1) / <span class="number">2</span> - <span class="number">1</span>) &lt; ns1 ? ns1 : (ns1 + ne1) / <span class="number">2</span> - <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> <span class="keyword">if</span> (indexone &lt; need[index][<span class="number">0</span>]) &#123;</span><br><span class="line">                    ns1 = ((ns1 + ne1) / <span class="number">2</span> + <span class="number">1</span>) &gt; ne1 ? ne1 : (ns1 + ne1) / <span class="number">2</span> + <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                    need[index][<span class="number">1</span>] = needone;</span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">                <span class="keyword">if</span> (indextwo &gt; need[index][<span class="number">0</span>]) &#123;</span><br><span class="line">                    ne2 = ((ns2 + ne2) / <span class="number">2</span> - <span class="number">1</span>) &lt; ns2 ? ns2 : (ns2 + ne2) / <span class="number">2</span> - <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> <span class="keyword">if</span> (indextwo &lt; need[index][<span class="number">0</span>]) &#123;</span><br><span class="line">                    ns2 = ((ns2 + ne2) / <span class="number">2</span> + <span class="number">1</span>) &gt; ne2 ? ne2 : (ns2 + ne2) / <span class="number">2</span> + <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                    need[index][<span class="number">1</span>] = needtwo;</span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            index++;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> ((<span class="keyword">double</span>) need[<span class="number">0</span>][<span class="number">1</span>] + (<span class="keyword">double</span>) need[<span class="number">1</span>][<span class="number">1</span>]) / <span class="number">2</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">private</span> <span class="keyword">double</span> <span class="title">getzhong</span><span class="params">(<span class="keyword">int</span>[] nums1)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (nums1.length % <span class="number">2</span> == <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> ((<span class="keyword">double</span>) nums1[(nums1.length / <span class="number">2</span> - <span class="number">1</span>)] + (<span class="keyword">double</span>) nums1[(nums1.length / <span class="number">2</span>)]) / <span class="number">2.0</span>;</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="keyword">return</span> nums1[nums1.length / <span class="number">2</span>];</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getAllIndex</span><span class="params">(<span class="keyword">int</span>[] n, <span class="keyword">int</span> before, <span class="keyword">int</span> item, <span class="keyword">int</span> start, <span class="keyword">int</span> end, <span class="keyword">int</span> type)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">while</span> (start &lt; end) &#123;</span><br><span class="line">            <span class="keyword">if</span> (type == <span class="number">1</span>) &#123;</span><br><span class="line">                <span class="keyword">if</span> (item &gt; n[(start + end) / <span class="number">2</span>]) &#123;</span><br><span class="line">                    start = (start + end) / <span class="number">2</span> + <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                    end = (start + end) / <span class="number">2</span> - <span class="number">1</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                <span class="keyword">if</span> (item &gt;= n[(start + end) / <span class="number">2</span>]) &#123;</span><br><span class="line">                    start = (start + end) / <span class="number">2</span> + <span class="number">1</span>;</span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                    end = (start + end) / <span class="number">2</span> - <span class="number">1</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (n[start] &lt; item) &#123;</span><br><span class="line">            <span class="keyword">return</span> before + start + <span class="number">2</span>;</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="keyword">return</span> before + start + <span class="number">1</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="最长回文字串"><a href="#最长回文字串" class="headerlink" title="最长回文字串"></a>最长回文字串</h3><p>马拉车算法  —&gt; 一种思维，寻找关系，像回文数组 排序数组，都是有特性的，比如回文传回文中心左右是相同的，在排序数组中具有数据大小的特点，这题的思路就是典型的贪心，解决贪心问题的核心就是找到特点和发散思维</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code05</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="keyword">new</span> Code05().longestPalindrome(<span class="string">"babad"</span>));</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 使用Manacher算法</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> s</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">longestPalindrome</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">char</span>[] at = <span class="keyword">new</span> <span class="keyword">char</span>[s.length() * <span class="number">2</span> + <span class="number">1</span>];</span><br><span class="line">        <span class="keyword">int</span>[] length = <span class="keyword">new</span> <span class="keyword">int</span>[s.length() * <span class="number">2</span> + <span class="number">1</span>];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a = <span class="number">0</span>; a &lt; s.length(); a++) &#123;</span><br><span class="line">            at[a * <span class="number">2</span>] = <span class="string">'#'</span>;</span><br><span class="line">            at[<span class="number">2</span> * a + <span class="number">1</span>] = s.charAt(a);</span><br><span class="line">        &#125;</span><br><span class="line">        at[at.length - <span class="number">1</span>] = <span class="string">'#'</span>;</span><br><span class="line">        length[<span class="number">0</span>] = <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">int</span> nowIndex = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> index = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a = <span class="number">0</span>; a &lt; at.length; a++) &#123;</span><br><span class="line">            <span class="keyword">if</span> (nowIndex + length[nowIndex] &gt; a) &#123;</span><br><span class="line">                length[a] = Math.min(nowIndex + length[nowIndex] - a, length[<span class="number">2</span> * nowIndex - a]);</span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                length[a] = <span class="number">1</span>;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">while</span> (a - length[a] &gt;= <span class="number">0</span> &amp;&amp; a + length[a] &lt;= at.length - <span class="number">1</span>) &#123;</span><br><span class="line">                <span class="keyword">if</span> (at[a - length[a]] == at[a + length[a]]) &#123;</span><br><span class="line">                    length[a]++;</span><br><span class="line">                    <span class="keyword">continue</span>;</span><br><span class="line">                &#125;</span><br><span class="line">                <span class="comment">//break;</span></span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span> (a + length[a] &gt; nowIndex + length[nowIndex]) &#123;</span><br><span class="line">                nowIndex = a;</span><br><span class="line">            &#125;</span><br><span class="line">            index = length[index] &lt; length[a] ? a : index;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> getString(index,length,at);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getString</span><span class="params">(<span class="keyword">int</span> index, <span class="keyword">int</span>[] length, <span class="keyword">char</span>[] at)</span> </span>&#123;</span><br><span class="line">        ArrayList&lt;Character&gt; arrayList = <span class="keyword">new</span> ArrayList&lt;&gt;();</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> start = index - length[index] + <span class="number">1</span>, end = index + length[index] - <span class="number">1</span>; start &lt;= end; start++) &#123;</span><br><span class="line">            <span class="keyword">if</span> (at[start] != <span class="string">'#'</span>) &#123;</span><br><span class="line">                arrayList.add(at[start]);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span>[] c = <span class="keyword">new</span> <span class="keyword">char</span>[arrayList.size()];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;arrayList.size();a++)&#123;</span><br><span class="line">            c[a]=arrayList.get(a);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">new</span> String(c);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="Z-字形变换"><a href="#Z-字形变换" class="headerlink" title="Z 字形变换"></a>Z 字形变换</h3><p>将字符串 “PAYPALISHIRING” 以Z字形排列成给定的行数：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">P   A   H   N</span><br><span class="line">A P L S I I G</span><br><span class="line">Y   I   R</span><br></pre></td></tr></table></figure></p>
<p>之后从左往右，逐行读取字符：”PAHNAPLSIIGYIR”</p>
<p>这个提我的思路就将这个问题分解 Z 字形从上倒下是一类，斜着是一类分类解决</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code06</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="keyword">new</span> Code06().convert(<span class="string">"A"</span>,<span class="number">1</span>));</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">convert</span><span class="params">(String s, <span class="keyword">int</span> numRows)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(s.equals(<span class="string">""</span>)||numRows==<span class="number">1</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> s;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span>[] ca= <span class="keyword">new</span> <span class="keyword">char</span>[s.length()];</span><br><span class="line">        <span class="keyword">char</span>[] item = s.toCharArray();</span><br><span class="line">        <span class="keyword">int</span> speed = numRows*<span class="number">2</span>-<span class="number">2</span>;</span><br><span class="line">        <span class="keyword">int</span> speed2 = speed;</span><br><span class="line">        <span class="keyword">int</span> index=<span class="number">0</span>;</span><br><span class="line">        <span class="keyword">int</span> line = s.length()%speed==<span class="number">0</span>?s.length()/speed:s.length()/speed+<span class="number">1</span>;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">0</span>;a&lt;numRows;a++)&#123;</span><br><span class="line">            speed2=speed-<span class="number">2</span>*a;</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> b=<span class="number">0</span>;b&lt;line;b++)&#123;</span><br><span class="line">                <span class="keyword">if</span> (b*speed+a&lt;s.length())&#123;</span><br><span class="line">                    ca[index]=item[b*speed+a];</span><br><span class="line">                    index++;</span><br><span class="line">                &#125;</span><br><span class="line">                <span class="keyword">if</span> (speed2!=<span class="number">0</span>&amp;&amp;(b*speed+a+speed2)%speed!=<span class="number">0</span>&amp;&amp;b*speed+a+speed2&lt;s.length())&#123;</span><br><span class="line">                    ca[index]=item[b*speed+a+speed2];</span><br><span class="line">                    index++;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">new</span> String(ca);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="反转整数"><a href="#反转整数" class="headerlink" title="反转整数"></a>反转整数</h3><p>这个没什么就是有一种思路使用long 类型解决int 类型溢出的问题，还可以使用使用异常的方法解决这个问题</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code7</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="keyword">new</span> Code7().reverse(-<span class="number">2147483412</span>));</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">reverse</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">        String s = String.valueOf(x);</span><br><span class="line">        <span class="keyword">if</span> (x&gt;=<span class="number">0</span>)&#123;</span><br><span class="line">            s=<span class="string">"+"</span>+s;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span> c[] = s.toCharArray();</span><br><span class="line">        <span class="keyword">char</span> c2[] = <span class="keyword">new</span> <span class="keyword">char</span>[c.length];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">1</span>;a&lt;c.length;a++)&#123;</span><br><span class="line">            c2[c.length-a]=c[a];</span><br><span class="line">        &#125;</span><br><span class="line">        c2[<span class="number">0</span>]=c[<span class="number">0</span>];</span><br><span class="line">        <span class="keyword">if</span> (c2.length-<span class="number">1</span>&gt;=<span class="number">10</span>)&#123;<span class="comment">// 不必考虑2的31次方-1的情况应为肯定取不到</span></span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">1</span>,b=<span class="number">0</span>;a&lt;c2.length;a++,b++)&#123;</span><br><span class="line">                <span class="keyword">if</span>(b&gt;=<span class="number">10</span>||c2[a]&gt;MAXVULE[b])&#123;</span><br><span class="line">                    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">                &#125;<span class="keyword">else</span> <span class="keyword">if</span> (c2[a]&lt;MAXVULE[b])&#123;</span><br><span class="line">                    <span class="keyword">break</span>;</span><br><span class="line">                &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">                    <span class="keyword">continue</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> Integer.valueOf(<span class="keyword">new</span> String(c2));</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">static</span> <span class="keyword">char</span>[] MAXVULE = <span class="keyword">new</span> <span class="keyword">char</span>[]&#123;<span class="string">'2'</span>,<span class="string">'1'</span>,<span class="string">'4'</span>,<span class="string">'7'</span>,<span class="string">'4'</span>,<span class="string">'8'</span>,<span class="string">'3'</span>,<span class="string">'6'</span>,<span class="string">'4'</span>,<span class="string">'8'</span>&#125;;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">reverse2</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">        String s = String.valueOf(x);</span><br><span class="line">        <span class="keyword">if</span> (x&gt;=<span class="number">0</span>)&#123;</span><br><span class="line">            s=<span class="string">"+"</span>+s;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">char</span> c[] = s.toCharArray();</span><br><span class="line">        <span class="keyword">char</span> c2[] = <span class="keyword">new</span> <span class="keyword">char</span>[c.length];</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> a=<span class="number">1</span>;a&lt;c.length;a++)&#123;</span><br><span class="line">            c2[c.length-a]=c[a];</span><br><span class="line">        &#125;</span><br><span class="line">        c2[<span class="number">0</span>]=c[<span class="number">0</span>];</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            <span class="keyword">return</span> Integer.valueOf(<span class="keyword">new</span> String(c2));</span><br><span class="line">        &#125;<span class="keyword">catch</span> (Exception e)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">reverse3</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">boolean</span> negative = x &lt; <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">if</span> (negative) x = -x;</span><br><span class="line">        <span class="keyword">long</span> r = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">while</span> (x&gt;<span class="number">0</span>) &#123;</span><br><span class="line">            r = r * <span class="number">10</span> + x % <span class="number">10</span>;</span><br><span class="line">            x /= <span class="number">10</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (negative) r = -r;</span><br><span class="line">        <span class="keyword">if</span> (r &gt; Integer.MAX_VALUE || r &lt; Integer.MIN_VALUE) <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">return</span> (<span class="keyword">int</span>)r;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="回文数"><a href="#回文数" class="headerlink" title="回文数"></a>回文数</h3><p>判断一个整数是否是回文数。回文数是指正序（从左向右）和倒序（从右向左）读都是一样的整数。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">输入: 121</span><br><span class="line">输出: true</span><br><span class="line">示例 2:</span><br></pre></td></tr></table></figure>
<p>最好的思路，回文数的特点就是正的和反的是相同的也就是说将这个从后到前变成整数就可以判断了</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Code9</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        System.out.println(<span class="keyword">new</span> Code9().isPalindrome(<span class="number">1000000001</span>));</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">isPalindrome</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (x&lt;<span class="number">0</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">long</span> maxPath = getItemPath(x);</span><br><span class="line">        <span class="keyword">long</span> minPath = <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">while</span> (minPath &lt;= maxPath) &#123;</span><br><span class="line">            <span class="keyword">int</span> before = (<span class="keyword">int</span>) (x / (maxPath / <span class="number">10</span>)-(x/maxPath)*<span class="number">10</span>);</span><br><span class="line">            <span class="keyword">int</span> end = (<span class="keyword">int</span>) ((x % (minPath * <span class="number">10</span>) - x % minPath)/minPath);</span><br><span class="line">            <span class="keyword">if</span> (before != end) &#123;</span><br><span class="line">                <span class="keyword">return</span> <span class="keyword">false</span>;</span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                maxPath /= <span class="number">10</span>;</span><br><span class="line">                minPath *= <span class="number">10</span>;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">long</span> <span class="title">getItemPath</span><span class="params">(<span class="keyword">int</span> x)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">long</span> a = <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">do</span> &#123;</span><br><span class="line">            x = x / <span class="number">10</span>;</span><br><span class="line">            a *= <span class="number">10</span>;</span><br><span class="line">        &#125; <span class="keyword">while</span> (x &gt; <span class="number">0</span>);</span><br><span class="line">        <span class="keyword">return</span> a;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 第二种解法</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> input</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">isPalindrome2</span><span class="params">(<span class="keyword">int</span> input)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (input &lt; <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">boolean</span> result = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">int</span> origin = input;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">int</span> temp = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">while</span> (input != <span class="number">0</span>) &#123;</span><br><span class="line">            temp = temp * <span class="number">10</span> + input % <span class="number">10</span>;</span><br><span class="line">            input = input / <span class="number">10</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (temp == origin) &#123;</span><br><span class="line">            result = <span class="keyword">true</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span>  result;     </span><br><span class="line">        </span><br><span class="line">    &#125;   </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/10/09/详解http协议-状态码和报文信息/" rel="next" title="">
                <i class="fa fa-chevron-left"></i> 
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/10/09/spring扩展(二)application（集装箱扩展）/" rel="prev" title="">
                 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">kyssion</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">133</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">分类</span>
                
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">2</span>
                  <span class="site-state-item-name">标签</span>
                
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-两数之和"><span class="nav-number">1.</span> <span class="nav-text">1. 两数之和</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-两数相加"><span class="nav-number">2.</span> <span class="nav-text">2. 两数相加</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-无重复字符的最长子串"><span class="nav-number">3.</span> <span class="nav-text">3. 无重复字符的最长子串</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#两个排序数组的中位数"><span class="nav-number">4.</span> <span class="nav-text">两个排序数组的中位数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#最长回文字串"><span class="nav-number">5.</span> <span class="nav-text">最长回文字串</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Z-字形变换"><span class="nav-number">6.</span> <span class="nav-text">Z 字形变换</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#反转整数"><span class="nav-number">7.</span> <span class="nav-text">反转整数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#回文数"><span class="nav-number">8.</span> <span class="nav-text">回文数</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">kyssion</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
